package com.reconcile.phone.web.controller.system;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.reconcile.phone.business.domain.bo.RpPhoneCodeBo;
import com.reconcile.phone.business.domain.bo.RpPhoneOrderBo;
import com.reconcile.phone.business.domain.vo.RpPhoneCodeVo;
import com.reconcile.phone.business.domain.vo.RpPhoneOrderVo;
import com.reconcile.phone.business.service.RpPhoneOrderService;
import com.reconcile.phone.common.core.domain.PageQuery;
import com.reconcile.phone.common.core.domain.R;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

/**
 * 后台 订单管理
 *
 * Author: liuliyou
 * Date: 2025/8/9
 */
@RestController
@Validated
@RequiredArgsConstructor
@RequestMapping("/system/phoneOrder")
public class SysRpPhoneOrderController {

    private final RpPhoneOrderService rpPhoneOrderService;

    /**
     * 订单列表分页查询
     *
     * @param bo
     * @param pageQuery
     * @return
     */
    @GetMapping("/list")
    public R<Page<RpPhoneOrderVo>> list(RpPhoneOrderBo bo, PageQuery pageQuery) {
        return R.ok(rpPhoneOrderService.selectSysOrderList(bo, pageQuery));
    }

    /**
     * 订单详细信息
     *
     * @param phoneOrderId 主键
     */
    @GetMapping("/{phoneOrderId}")
    public R<RpPhoneOrderVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long phoneOrderId) {
        return R.ok(rpPhoneOrderService.queryPhoneOrderById(phoneOrderId));
    }
}
